package com.testmanager.testmananger.shuiyou.strCompare.mapper;

import com.testmanager.testmananger.shuiyou.strCompare.domain.SyProjectEntity;
import com.testmanager.testmananger.shuiyou.strCompare.dto.SyProjectDto;

import java.util.List;

public class SyProjectMapper {

    public static SyProjectEntity toSyprojectEntity(SyProjectDto  projectDto,long parentId){

        return  new SyProjectEntity().setId(projectDto.getId())
                .setName(projectDto.getName())
                .setParentId(parentId);
    }


    public static SyProjectDto toSyprojectDto(SyProjectEntity projectEntity, List<SyProjectDto>  childrens){
        if( null == projectEntity){
            return null;
        }

        return new SyProjectDto()
                .setId(projectEntity.getId())
                .setName(projectEntity.getName())
                .setParentId(projectEntity.getParentId())
                .setChildren(childrens);

    }
}
